﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FacultyImplementation
{
    class Faculty
    {
        public string facultyName;
        public string firstNameHeadOfFaculty;
        public string lastNameHeadOfFaculty;

        List<Department> departmentsList = new List<Department>();

        public void AddFacultyInfo()
        {
            Console.WriteLine("-----Faculty adding-----");
            Console.Write("Enter faculty name: ");
            facultyName = Console.ReadLine();
            Console.Write("Enter first name head of faculty: ");
            firstNameHeadOfFaculty = Console.ReadLine();
            Console.Write("Enter last name head of faculty: ");
            lastNameHeadOfFaculty = Console.ReadLine();
        }

        public void AddDepartmentToFaculty()
        {
            string select = "N";
            do
            {
                Console.WriteLine("-----Department adding-----");
                Department department = new Department();
                department.AddDepartmentInfo();
                department.AddGroupsToDepartment();
                departmentsList.Add(department);
                Console.WriteLine("Continue department adding? Y/N");
                select = Console.ReadLine().ToUpper();
            }
            while (select == "Y");
        }

        public void FacultyShowInfo()
        {
            Console.WriteLine("Faculty name: {0}", facultyName);
            Console.WriteLine("Head of faculty: {0} {1}", firstNameHeadOfFaculty, lastNameHeadOfFaculty);
            foreach (var departments in departmentsList)
            {
                departments.DepartmentShowInfo();
            }
        }

        public void OnlyDepartmentNameShowInfo()
        {
            foreach (var departments in departmentsList)
            {
                departments.OnlyDepartmentNameShowInfo();
            }
        }

        public void ShowStudentsOnTheParticularDepartment()
        {
            Console.Write("Enter department name to show list of students: ");
            string departmentNameFromUser = Console.ReadLine();
            foreach(var department in departmentsList)
            {
                if (departmentNameFromUser == department.departmentName)
                {
                    department.OnlyStudentsShowInfo();
                }
            }
        }
    }
}
